package com.bignerdranch.android.ecar.Activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ListView;

import com.bignerdranch.android.ecar.Adapter.RefuelAdapter;
import com.bignerdranch.android.ecar.Bean.RefuelBean;
import com.bignerdranch.android.ecar.R;

import java.util.ArrayList;
import java.util.List;

public class RefuelActivity extends BaseActivity implements View.OnClickListener {

    private ImageButton add_car_back;
    private ListView refuel_list;
    private List<RefuelBean> mData;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_refuel);
        initView();
        intiData();
        refuel_list.setAdapter(new RefuelAdapter(this,mData));
    }

    private void initView() {
        add_car_back = (ImageButton) findViewById(R.id.add_car_back);
        refuel_list = (ListView) findViewById(R.id.refuel_list);


        add_car_back.setOnClickListener(this);
    }

    private void intiData(){
        mData = new ArrayList<>();
        for(int i = 0;i <10 ;i++){
            RefuelBean bean = new RefuelBean("大桥石化",(1.5+i*8)+"km","农业路东风路");
            mData.add(bean);
        }
    }
    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.add_car_back:
                finish();
                break;
        }
    }
}
